<template>
  <router-link to="/home">home</router-link>
  |
  <router-link to="/about">about</router-link>
  |
  <router-link :to="'/user/'+userId">user</router-link>
  |
  <button @click="userClick">点击user</button>
  |

  <router-link :to="{path: '/profile', query: {name: 'zhansgan', age: 14, height: 18.8}}">profile</router-link>
  |
  <button @click="profileClick">点击Profile</button>

  <router-view/>
</template>
<script>
  export default {
    name: 'App',
    data(){
      return {
        userId: '123'
      }
    },
    methods: {
      userClick(){
        this.$router.replace("/user/"+this.userId)
      },
      profileClick(){
        this.$router.replace({
          path: '/profile',
          query: {name: 'lis', age: 18, height: 8.8}
        })
      }
    }
  }
</script>
<style>


</style>
